<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Function Properties (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Function Properties (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Function Properties (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Functions.html" rel="up" title="Functions">
<link href="Function-Basics.html" rel="prev" title="Function Basics">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Function-Properties">
<div class="nav-panel">
<p>
Previous: <a href="Function-Basics.html" accesskey="p" rel="prev">Function Basics</a>, Up: <a href="Functions.html" accesskey="u" rel="up">Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Function-Properties-1"><span>11.8.2 Function Properties<a class="copiable-link" href="#Function-Properties-1"> &para;</a></span></h4>
<a class="index-entry-id" id="index-function-properties"></a>
<a class="index-entry-id" id="index-statements"></a>

<p>To determine the scope of a function, you can use the
<code class="code">DECL_CONTEXT</code> macro.  This macro will return the class
(either a <code class="code">RECORD_TYPE</code> or a <code class="code">UNION_TYPE</code>) or namespace (a
<code class="code">NAMESPACE_DECL</code>) of which the function is a member.  For a virtual
function, this macro returns the class in which the function was
actually defined, not the base class in which the virtual declaration
occurred.
</p>
<p>In C, the <code class="code">DECL_CONTEXT</code> for a function maybe another function.
This representation indicates that the GNU nested function extension
is in use.  For details on the semantics of nested functions, see the
GCC Manual.  The nested function can refer to local variables in its
containing function.  Such references are not explicitly marked in the
tree structure; back ends must look at the <code class="code">DECL_CONTEXT</code> for the
referenced <code class="code">VAR_DECL</code>.  If the <code class="code">DECL_CONTEXT</code> for the
referenced <code class="code">VAR_DECL</code> is not the same as the function currently
being processed, and neither <code class="code">DECL_EXTERNAL</code> nor
<code class="code">TREE_STATIC</code> hold, then the reference is to a local variable in
a containing function, and the back end must take appropriate action.
</p>
<dl class="ftable">
<dt><a id="index-DECL_005fEXTERNAL-1"></a><span><code class="code">DECL_EXTERNAL</code><a class="copiable-link" href="#index-DECL_005fEXTERNAL-1"> &para;</a></span></dt>
<dd><p>This predicate holds if the function is undefined.
</p>
</dd>
<dt><a id="index-TREE_005fPUBLIC-1"></a><span><code class="code">TREE_PUBLIC</code><a class="copiable-link" href="#index-TREE_005fPUBLIC-1"> &para;</a></span></dt>
<dd><p>This predicate holds if the function has external linkage.
</p>
</dd>
<dt><a id="index-TREE_005fSTATIC"></a><span><code class="code">TREE_STATIC</code><a class="copiable-link" href="#index-TREE_005fSTATIC"> &para;</a></span></dt>
<dd><p>This predicate holds if the function has been defined.
</p>
</dd>
<dt><a id="index-TREE_005fTHIS_005fVOLATILE"></a><span><code class="code">TREE_THIS_VOLATILE</code><a class="copiable-link" href="#index-TREE_005fTHIS_005fVOLATILE"> &para;</a></span></dt>
<dd><p>This predicate holds if the function does not return normally.
</p>
</dd>
<dt><a id="index-TREE_005fREADONLY"></a><span><code class="code">TREE_READONLY</code><a class="copiable-link" href="#index-TREE_005fREADONLY"> &para;</a></span></dt>
<dd><p>This predicate holds if the function can only read its arguments.
</p>
</dd>
<dt><a id="index-DECL_005fPURE_005fP"></a><span><code class="code">DECL_PURE_P</code><a class="copiable-link" href="#index-DECL_005fPURE_005fP"> &para;</a></span></dt>
<dd><p>This predicate holds if the function can only read its arguments, but
may also read global memory.
</p>
</dd>
<dt><a id="index-DECL_005fVIRTUAL_005fP"></a><span><code class="code">DECL_VIRTUAL_P</code><a class="copiable-link" href="#index-DECL_005fVIRTUAL_005fP"> &para;</a></span></dt>
<dd><p>This predicate holds if the function is virtual.
</p>
</dd>
<dt><a id="index-DECL_005fARTIFICIAL-2"></a><span><code class="code">DECL_ARTIFICIAL</code><a class="copiable-link" href="#index-DECL_005fARTIFICIAL-2"> &para;</a></span></dt>
<dd><p>This macro holds if the function was implicitly generated by the
compiler, rather than explicitly declared.  In addition to implicitly
generated class member functions, this macro holds for the special
functions created to implement static initialization and destruction, to
compute run-time type information, and so forth.
</p>
</dd>
<dt><a id="index-DECL_005fFUNCTION_005fSPECIFIC_005fTARGET-1"></a><span><code class="code">DECL_FUNCTION_SPECIFIC_TARGET</code><a class="copiable-link" href="#index-DECL_005fFUNCTION_005fSPECIFIC_005fTARGET-1"> &para;</a></span></dt>
<dd><p>This macro returns a tree node that holds the target options that are
to be used to compile this particular function or <code class="code">NULL_TREE</code> if
the function is to be compiled with the target options specified on
the command line.
</p>
</dd>
<dt><a id="index-DECL_005fFUNCTION_005fSPECIFIC_005fOPTIMIZATION-1"></a><span><code class="code">DECL_FUNCTION_SPECIFIC_OPTIMIZATION</code><a class="copiable-link" href="#index-DECL_005fFUNCTION_005fSPECIFIC_005fOPTIMIZATION-1"> &para;</a></span></dt>
<dd><p>This macro returns a tree node that holds the optimization options
that are to be used to compile this particular function or
<code class="code">NULL_TREE</code> if the function is to be compiled with the
optimization options specified on the command line.
</p>
</dd>
</dl>


</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Function-Basics.html">Function Basics</a>, Up: <a href="Functions.html">Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
